<template>
  <el-container class="admin-layout">
    <!-- 侧边栏 -->
    <el-aside width="200px" class="sidebar">
      <div class="logo">钛考管理系统</div>
      <el-menu
        :default-active="$route.path"
        class="el-menu-vertical-demo"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
        router
      >
        <!-- <el-menu-item index="/admin">
          <el-icon><House /></el-icon>
          <span>首页</span>
        </el-menu-item> -->
        <el-sub-menu index="user">
          <template #title>
            <el-icon><User /></el-icon>
            <span>用户管理</span>
          </template>
          <el-menu-item index="/admin/students">学生管理</el-menu-item>
          <el-menu-item index="/admin/teachers">教师管理</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="organization">
          <template #title>
            <el-icon><OfficeBuilding /></el-icon>
            <span>组织管理</span>
          </template>
          <el-menu-item index="/admin/colleges">学院管理</el-menu-item>
          <el-menu-item index="/admin/majors">专业管理</el-menu-item>
          <el-menu-item index="/admin/classes">班级管理</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>

    <!-- 主内容区 -->
    <el-container class="main-container">
      <!-- 头部 -->
      <el-header class="header">
        <div class="header-content">
          <h2>在线考试系统管理员端</h2>
          <div class="user-info">
            <el-dropdown>
              <span class="el-dropdown-link">
                管理员 <el-icon class="el-icon--right"><arrow-down /></el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>个人信息</el-dropdown-item>
                  <el-dropdown-item>退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
      </el-header>

      <!-- 内容区 -->
      <el-main class="content">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import {
  House,
  User,
  OfficeBuilding,
  ArrowDown
} from '@element-plus/icons-vue'
</script>

<style scoped>
.admin-layout {
  height: 100vh;
}

.sidebar {
  background-color: #545c64;
  color: white;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.logo {
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background-color: #434b54;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header {
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
  padding: 0 20px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.user-info {
  display: flex;
  align-items: center;
}

.content {
  background-color: #f5f5f5;
  padding: 20px;
  overflow-y: auto;
}

.el-menu-vertical-demo {
  height: calc(100% - 60px);
  border-right: none;
  margin-top: 0;
}

.main-container {
  height: 100vh;
}
</style>